Skip to content

Conversation

Nataliia74
Copy link

Learners, PR Template

Self checklist

  • I have committed my files one by one, on purpose, and for a reason
  • I have titled my PR with Region | Cohort | FirstName LastName | Sprint | Assignment Title
  • I have tested my changes
  • My changes follow the style guide
  • My changes meet the requirements of this task

Changelist

Briefly explain your PR.

Questions

Ask any questions you have for your reviewer.

@Nataliia74 Nataliia74 added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Aug 4, 2025
@a-robson a-robson added Review in progress This review is currently being reviewed. This label will be replaced by "Reviewed" soon. and removed Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels Aug 5, 2025
Copy link

@a-robson a-robson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall this is very good. You are making great progress. There are some stylistic issues to address.

Comment on lines 82 to 84

const result = gryffindorMembers(hogwarts);

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The functions are good. However there are a couple of issues with this line. What would happen if you didn't pass in hogwarts as a parameter? What is the value of the result variable? Also, there's a spacing issue - Javascript convention is to have no space between the function name and the opening parenthesis for parameters.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In my case, the answer will be the same, because I use hogwarts inside my function. To use hogwarts as a parameter, I would write code differently to pass, for example, an array in parentheses as a parameter in declaring a function and use the array to filter members. The type value of the result variable is an object(be clear, an array).

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello Andrew, In my case, the answer will be the same, because I use hogwarts inside my function. To use hogwarts as a parameter, I would write code differently to pass, for example, an array in parentheses as a parameter in declaring a function and use thearrayto filter members. The type value of the result variable is an object(be clear, an array).

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes the hogwarts variable was declared globally so there was no need to pass it into the function. The function doesn't return anything so result will be undefined.

Comment on lines 10 to 22
function getTotalOfOrder (order) {
let Total = 0;
console.log("QTY".padEnd(8), "ITEM".padEnd(24), "TOTAL");
order.forEach(({itemName, quantity, unitPricePence}) => {
const QTY = quantity;
const ITEM = itemName;
const TOTAL = ((unitPricePence * quantity)/100);
Total = Total + TOTAL;
console.log(`${String(QTY).padEnd(6)} ${String(ITEM).padEnd(24)} ${(TOTAL.toFixed(2)).padStart(4)}`);
})

console.log(`\nTotal: ${Total.toFixed(2)}`)
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The destructuring implementation follows best practices and the core functionality works correctly, producing the expected output. However, there are a few areas that need attention. Please ensure all variable and function names use camelCase consistently throughout the code. Additionally, consider whether the intermediate variables are really required or if some could be removed. The indentation also needs a little correction. I'd suggest running the code through prettier or some other code formatter to address styling issues automatically.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for focusing my attention on intermediate variables. I removed variables that I used only once and those whose absence would not influence code readability.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your new implementation is really good.

@a-robson a-robson added Reviewed Volunteer to add when completing a review with trainee action still to take. and removed Review in progress This review is currently being reviewed. This label will be replaced by "Reviewed" soon. labels Aug 5, 2025
@Nataliia74 Nataliia74 added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Aug 6, 2025
@illicitonion illicitonion changed the title CodeYourFuture/Module-Data-Flows | ITP-May-2025 | Nataliia Volkova |Feature/destructuring Glasgow | ITP-May-2025 | Nataliia Volkova | Sprint 1 | Destructuring Aug 7, 2025
@a-robson a-robson added Complete Volunteer to add when work is complete and all review comments have been addressed. and removed Reviewed Volunteer to add when completing a review with trainee action still to take. Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels Aug 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Complete Volunteer to add when work is complete and all review comments have been addressed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants